<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="文档管理">
<meta name="author" content="文档管理">
<title>简介 文档管理</title>
<link href="./assets/css/bootstrap.min.css" rel="stylesheet">
<!-- Documentation extras -->
<link href="./assets/css/docs.css" rel="stylesheet">
<link href="./assets/css/style.css" rel="stylesheet">
<link href="http://cdn.bootcss.com/highlight.js/7.3/styles/github.min.css" rel="stylesheet">
<style>
body{font-family:"ff-tisa-web-pro-1","ff-tisa-web-pro-2","Lucida Grande","Helvetica Neue",Helvetica,Arial,"Hiragino Sans GB","Hiragino Sans GB W3","WenQuanYi Micro Hei",sans-serif;}
h1, .h1, h2, .h2, h3, .h3, h4, .h4, .lead {font-family:"ff-tisa-web-pro-1","ff-tisa-web-pro-2","Lucida Grande","Helvetica Neue",Helvetica,Arial,"Hiragino Sans GB","Hiragino Sans GB W3","Microsoft YaHei UI","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif;}
pre code { background: transparent; }
@media (min-width: 768px) {
    .bs-docs-home .bs-social, 
    .bs-docs-home .bs-masthead-links {
      margin-left: 0;
    }
}
.bs-docs-section p {
	line-height: 2;
}
.bs-docs-section p.lead {
	line-height: 1.4;
}
</style>
<!--[if lt IE 9]><script src="../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>
  <script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<!-- Favicons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../docs-assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="../docs-assets/ico/favicon.png">
  </head>
  <body>
    <a class="sr-only" href="#content">Skip to main content</a>

    <!-- Docs master nav -->
    <header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner">
  <div class="container">
    <div class="navbar-header">
      <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a href="./overview.html" class="navbar-brand">文档管理</a>
    </div>
    <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
      <ul class="nav navbar-nav">
       		<li class='active' ><a href="overview.html" class="selected">简介</a></li>
            <li ><a href="download.html">下载</a></li>
            <li ><a href="userguide.html">开发指南</a></li>
            <li ><a href="config.html">配置指南</a></li>
            <li ><a href="syntax.html">语法指南</a></li>
            <li ><a href="integrate.html">Web 框架集成</a></li>
            <!--
            <li ><a href="example.html">例子</a></li>
            -->
            <li ><a href="faq.html">FAQ</a></li>
            <li ><a href="about.html">关于</a></li>
      </ul>
    </nav>
  </div>
</header>
    <!-- Docs page layout -->
    <div class="bs-header" id="content">
      <div class="container">
        <h2>简介</h2>
        <p>jetbrick-template 是一个新一代 Java 模板引擎</p>
      </div>
    </div>
	<a href="#top" id="toTop"></a>
    <!-- Callout for the old docs link -->
    <div class="container bs-docs-container">
      <div class="row">
        <div class="col-md-3">
          <div class="bs-sidebar hidden-print" role="complementary">
            <ul class="nav bs-sidenav">
            <li><a href="#x545226443">1 概述 Overview</a></li>
            <li><a href="#x441533943">2 简单易用的指令</a></li>
            <li><a href="#x2020869891">3 卓越性能 Performance</a></li>
            <li><a href="#x1568210646">4 易于集成 Integrate</a></li>
            <li><a href="#x408827026">5 友好的错误提示</a></li>
            </ul>
          </div>
        </div>
	        <div class="col-md-9" role="main">
	         <div class="bs-docs-section">
	           <h1 id="x545226443" class="page-header"><span>1 概述 Overview</span></h1>
<p>==================</p>
<p>jetbrick-template 是一个新一代 Java 模板引擎，具有高性能和高扩展性。 适合于动态 HTML 页面输出或者代码生成，可替代 JSP 页面或者 Velocity 等模板。 指令和 Velocity 相似，表达式和 Java 保持一致，易学易用。</p> 
<ul> 
 <li>支持类似于 Velocity 的多种指令</li> 
 <li>支持静态编译</li> 
 <li>支持编译缓存</li> 
 <li>支持热加载</li> 
 <li>支持类型推导</li> 
 <li>支持泛型</li> 
 <li>支持可变参数方法调用</li> 
 <li>支持方法重载</li> 
 <li>支持类似于 Groovy 的方法扩展</li> 
 <li>支持函数扩展</li> 
 <li>支持自定义标签 #tag</li> 
 <li>支持宏定义 #macro</li> 
 <li>支持布局 Layout</li> 
</ul>
<h1 id="x441533943" class="page-header"><span>2 简单易用的指令</span></h1>
<p>jetbrick-template 指令集和老牌的模板引擎 Velocity 非常相似，易学易用。</p> 
<div class="highlight">
 <pre><code class="language-html">#define(List&lt;UserInfo&gt; userlist)
&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;序号&lt;/td&gt;
    &lt;td&gt;姓名&lt;/td&gt;
    &lt;td&gt;邮箱&lt;/td&gt;
  &lt;/tr&gt;
  #for (UserInfo user : userlist)
  &lt;tr&gt;
    &lt;td&gt;${for.index}&lt;/td&gt;
    &lt;td&gt;${user.name}&lt;/td&gt;
    &lt;td&gt;${user.email}&lt;/td&gt;
  &lt;/tr&gt;
  #end
&lt;/table&gt;
</code></pre>
</div>
<p>详细指令语法，请参考：<a href="syntax.html">语法指南</a>。或者<a href="syntax.html#velocity">和 Velocity 的比较</a>。</p>
<h1 id="x2020869891" class="page-header"><span>3 卓越性能 Performance</span></h1>
<p>jetbrick-template 将模板编译成 Java ByteCode 运行，并采用强类型推导，无需反射和减少类型转换。渲染速度等价于 Java 硬编码。比 Velocity 等模板快一个数量级。 比 JSP 也快，因为 JSP 只有 Scriptlet 是编译的，Tag 和 EL 都是解释执行的。 而 jetbrick-template 是全编译的。</p>
<p><img src="../assets/images/perfermance.png" alt="performance" /></p>
<p>在 Stream 模式中(Webapp 采用 OutputStream 将文本输出到浏览器)，由于 Java 硬编码输出字符串需要进行一次编码的转换。 而 jetbrick-template 却在第一次运行期间就缓存了编码转换结果，使得 jetbrick-template 的性能甚至优于 Java 硬编码。</p>
<p>具体测试用例，请参考：<a href="https://github.com/subchen/ebm">Template Engine Benchmark Test</a> (platform: Window 7 x64, Intel i5, 16GB RAM, JDK 1.6.0_41 x64)</p>
<h1 id="x1568210646" class="page-header"><span>4 易于集成 Integrate</span></h1>
<p>可以和市面上常见的 Web MVC framework 进行集成。</p> 
<ul> 
 <li><a href="integrate.html#HttpServlet">HttpServlet</a></li> 
 <li><a href="integrate.html#Filter">Filter</a></li> 
 <li><a href="integrate.html#Struts">Struts 2.x</a></li> 
 <li><a href="integrate.html#SpringMVC">Spring MVC</a></li> 
 <li><a href="integrate.html#JFinal">JFinal</a></li> 
 <li><a href="integrate.html#Nutz">Nutz</a></li> 
 <li><a href="integrate.html#Jodd">Jodd</a></li> 
</ul>
<p>具体集成方法，请参考： <a href="integrate.html">Web 框架集成</a></p>
<p>也可以和 Spring Ioc 进行集成，请参考：<a href="faq-spring.html">如何在 Spring 中使用 JetEngine</a></p>
<h1 id="x408827026" class="page-header"><span>5 友好的错误提示</span></h1>
<p>具有详细的模板解析和编译错误提示，出错提示可以定位到原始模板所在的行号。</p> 
<div class="highlight">
 <pre><code class="language-html">22:14:51.271 [main] INFO  (JetTemplate.java:68) - Loading template source file: D:\workspace\github\jetbrick-schema-app\bin\config\report\schema.html.jetx
22:14:51.406 [main] ERROR (JetTemplateErrorListener.java:27) - Template parse failed:
D:\workspace\github\jetbrick-schema-app\bin\config\report\schema.html.jetx:37
message: The method getColumnNam() or isColumnNam() is undefined for the type jetbrick.schema.app.model.TableColumn.
33:         &lt;/tr&gt;
34:     #for(TableColumn c: t.columns)
35:         &lt;tr style=&quot;background-color:white;&quot;&gt;
36:             &lt;td&gt;${c.displayName}&lt;/td&gt;
37:             &lt;td&gt;${c.columnNam}&lt;/td&gt;
                        ^^^^^^^^^
 
Exception in thread &quot;main&quot; jetbrick.commons.exception.SystemException: java.lang.RuntimeException: The method getColumnNam() or isColumnNam() is undefined for the type jetbrick.schema.app.model.TableColumn.
  at jetbrick.commons.exception.SystemException.unchecked(SystemException.java:23)
  at jetbrick.commons.exception.SystemException.unchecked(SystemException.java:12)
  at jetbrick.schema.app.TemplateEngine.apply(TemplateEngine.java:44)
  at jetbrick.schema.app.Task.writeFile(Task.java:83)
  at jetbrick.schema.app.task.SqlReportTask.execute(SqlReportTask.java:19)
  at jetbrick.schema.app.SchemaGenerateApp.taskgen(SchemaGenerateApp.java:56)
  at jetbrick.schema.app.SchemaGenerateApp.main(SchemaGenerateApp.java:74)
Caused by: java.lang.RuntimeException: The method getColumnNam() or isColumnNam() is undefined for the type jetbrick.schema.app.model.TableColumn.
  at jetbrick.template.parser.JetTemplateCodeVisitor.reportError(JetTemplateCodeVisitor.java:1388)
  at jetbrick.template.parser.JetTemplateCodeVisitor.visitExpr_field_access(JetTemplateCodeVisitor.java:665)
  at jetbrick.template.parser.JetTemplateCodeVisitor.visitExpr_field_access(JetTemplateCodeVisitor.java:1)
...
</code></pre>
</div> 
<ul> 
 <li>出错模板：D:\workspace\github\jetbrick-schema-app\bin\config\report\schema.html.jetx</li> 
 <li>出错行号：37</li> 
 <li>错误原因：The method getColumnNam() or isColumnNam() is undefined for the type jetbrick.schema.app.model.TableColumn.</li> 
</ul>
<p>点击这里查看：<a href="faq-error.html">jetbrick-template 常见错误分析</a></p>
           	</div>
           </div>
		</div> 
 	</div>
    <!-- Footer
    ================================================== -->
    <footer class="bs-footer" role="contentinfo">
      <div class="container">
        <ul class="footer-links">
          <li>当前版本： v0.0.3</li>
          <li class="muted">&middot;</li>
          <li><a href="http://v2.bootcss.com/">Bootstrap 2.3.2 中文文档</a></li>
          <li class="muted">&middot;</li>
          <li><a href="http://www.bootcss.com">Bootstrap中文网</a></li>
          <li class="muted">&middot;</li>
          <li><a href="http://blog.getbootstrap.com">官方博客</a></li>
          <li class="muted">&middot;</li>
          <li><a href="https://github.com/twbs/bootstrap/issues?state=open">Issues</a></li>
          <li class="muted">&middot;</li>
          <li><a href="https://github.com/twbs/bootstrap/releases">Releases</a></li>
        </ul>
      </div>
    </footer>

    <!-- JS and analytics only. -->
<script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="./assets/js/bootstrap.js"></script>
<script src="http://cdn.bootcss.com/holder/2.0/holder.min.js"></script>
<script src="http://cdn.bootcss.com/highlight.js/7.3/highlight.min.js"></script>
<script >hljs.initHighlightingOnLoad();</script>
<script src="./assets/js/application.js"></script>
<script src="./assets/js/jquery.scrollToTop.min.js"></script>
<script text="javascript/text">
	$(document).ready(function(){
		$("#toTop").scrollToTop(1000);
  		$("table").addClass("table table-bordered");
  	});
</script>
  </body>
</html>
